Previous Book Contents Book Index Next

Inside Macintosh: QuickTime /
Chapter 3 - Image Compression Manager / Image Compression Manager Reference
Image Compression Manager Functions / Getting Information About Compressed Data


GetCompressionTime

The GetCompressionTime function allows your application to determine the estimated amount of time required to compress a given image. This function also allows you to verify that the quality settings you desire are supported by a given compressor component.

You specify the compression characteristics, including compression type and quality, along with the image.

pascal OSErr GetCompressionTime (PixMapHandle src,
                              const Rect *srcRect, 
                              short colorDepth, 
                              CodecType cType,
                              CompressorComponent codec, 
                              CodecQ *spatialQuality, 
                              CodecQ *temporalQuality,
                              unsigned long *compressTime);
src
Contains a handle to the source image. The source image must be stored in a pixel map structure. The compressor uses only the bit depth of this image to determine the compression time. You may set this parameter to nil if you are interested only in information about quality settings.
srcRect
Contains a pointer to a rectangle defining the portion of the source image to compress. You may set this parameter to nil if you are interested only in information about quality settings. GetCompressionTime then uses the bounds of the source pixel map.
colorDepth
Specifies the depth at which the image is to be compressed. If you set this parameter to 0, the Image Compression Manager determines the appropriate value for the source image. Values of 1, 2, 4, 8, 16, 24, and 32 indicate the number of bits per pixel for color images. Values of 34, 36, and 40 indicate 2-bit, 4-bit, and 8-bit grayscale, respectively, for grayscale images. Your program can determine which depths are supported by a given compressor by examining the compressor information structure returned by the GetCodecInfo function (see "Getting Information About Compressor Components" on page 3-56 for more information on the GetCodecInfo function).
cType
Specifies a compressor type. You must set this parameter to a
valid compressor type (see Table 3-3 on page 3-59 for a list of the available compressor types).
codec
Contains a compressor identifier. Specify a particular compressor by setting this parameter to its compressor identifier. Alternatively, you may use one of the special identifiers:
anyCodec
Choose the first compressor of the specified type
bestSpeedCodec
Choose the fastest compressor of the specified type
bestFidelityCodec
Choose the most accurate compressor of the specified type
bestCompressionCodec
Choose the compressor that produces the smallest resulting data
You can also specify a component instance. This may be useful if you have previously set some parameter on a specific instance of a codec field and want to make sure that the specified instance is used for that operation.
spatialQuality
Contains a pointer to a field containing the desired compressed image quality. The Image Compression Manager sets this field to the closest actual quality that the compressor can achieve. See "Compression Quality Constants" beginning on page 3-52 for valid values. If you are not interested in this information, pass nil in this parameter.
temporalQuality
Contains a pointer to a field containing the desired temporal quality. Use this value only with images that are part of image sequences. The Image Compression Manager sets this field to the closest actual quality that the compressor can achieve. See "Compression Quality Constants" beginning on page 3-52 for valid values. If you are not interested in this information, pass nil in this parameter.
compressTime
Contains a pointer to a field to receive the compression time, in milliseconds. If the compressor cannot determine the amount of time required to compress the image or if the compressor does not support this function, this field is set to 0. If you are not interested in this information, pass nil in this parameter.
DESCRIPTION
The Image Compression Manager returns the maximum compression time for the specified image and parameters. Note that some compressors may not support this function. If the component you specify does not support this function, the Image Compression Manager returns a time value of 0.

RESULT CODES
noErr0No error
paramErr-50Invalid parameter specified
noCodecErr-8961The Image Compression Manager could not find the specified compressor

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996